package com.study.controller;

import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author tanglingyu
 * @Date: 2021/09/08/ 15:27
 * @Description
 */
@RestController
public class TestController5 {

//  @Value("${test.list:}")
//  private List<String> testList;

  @Value("${test.array1}")
  private String[] array1;

  @Value("${test.array2}")
  private int[] array2;

  @Value("${test.array3}")
  private double[] array3;

  @Value("#{'${test.list2}'.split(',')}")
  private List<String> testList2;

  @Value("#{'${test.set:}'.empty ? null : '${test.set:}'.split(',')}")
  private Set<Integer> testSet;

  @Value("#{${test.map1}}")
  private Map<String, String> map1;

  @Value("#{${test.map2}}")
  private Map<String, Integer> map2;

  /**
   * 还可以自定义解析方法
   */


  @PostConstruct
  public void test() {
    System.out.println("sb");
  }
}
